package JAVACORE_TRAINING.OOPs.DOWNCASTING.MoreExampleOf;

public class Parent {
	public static void main(String[] args) {
		Parent p = new Parent();
		Child01 c1 = new Child01();
		Child02 c2 = new Child02();

		System.out.println(c1 instanceof Parent); // true
		System.out.println(c2 instanceof Parent); // true
		System.out.println(p instanceof Child01); // false
		System.out.println(p instanceof Child02); // false

		p = c1;
		System.out.println(p instanceof Child01); // true
		System.out.println(p instanceof Child02); // false

		p = c2;
		System.out.println(p instanceof Child01); // false
		System.out.println(p instanceof Child02); // true
	}
}
